public class Solution {

        public static int firstUniqChar(String s) {
            int[] array = new int[26];
            int i =0;
            for(i = 0;i<s.length();i++){
                array[(int)s.charAt(i)-97]++;
            }
            for(i = 0;i<s.length();i++){
                if(array[(int)s.charAt(i)-97]==1){
                    return i;
                }
            }
            return -1;
        }

    public static void main(String[] args) {
        String s1 = "aabb";
        firstUniqChar(s1);
    }

}
